<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>encrypt</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_003_196">&nbsp;</a>NAME</h4><blockquote>
encrypt - encoding function
(<b>CRYPT</b>)
</blockquote><h4><a name = "tag_000_003_197">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="unistd.h.html">unistd.h</a>&gt;

void encrypt(char <i>block</i>[64], int <i>edflag</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_003_198">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>encrypt()</i>
function provides (rather primitive)
access to an implementation-dependent encoding algorithm.
The key generated by
<i><a href="setkey.html">setkey()</a></i>
is used to encrypt the string
<i>block</i>
with
<i>encrypt()</i>.
<p>
The
<i>block</i>
argument to
<i>encrypt()</i>
is an array of length 64 bytes containing only the bytes
with numerical value of 0 and 1.
The array is modified in place to a similar array
using the key set by
<i><a href="setkey.html">setkey()</a></i>.
If
<i>edflag</i>
is 0, the argument is encoded.  If
<i>edflag</i>
is 1, the argument may be decoded (see the APPLICATION USAGE
section below); if the argument is not decoded,
<i>errno</i>
will be set to [ENOSYS].
<p>
The
<i>encrypt()</i>
function will not change the setting of
<i>errno</i>
if successful.
<p>
This interface need not be reentrant.
</blockquote><h4><a name = "tag_000_003_199">&nbsp;</a>RETURN VALUE</h4><blockquote>
The
<i>encrypt()</i>
function returns no value.
</blockquote><h4><a name = "tag_000_003_200">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>encrypt()</i>function
will fail if:
<dl compact>

<dt>[ENOSYS]<dd>
The functionality is not supported on this implementation.

</dl>
</blockquote><h4><a name = "tag_000_003_201">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_003_202">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
In some environments, decoding might not be implemented.  This is related to
U.S. Government restrictions on encryption and decryption routines:
the DES decryption algorithm cannot be exported outside the U.S.A.
Historical practice has been to ship a different version of the encryption
library without the decryption feature in the routines supplied.
Thus the exported version of
<i>encrypt()</i>
does encoding but not decoding.
</blockquote><h4><a name = "tag_000_003_203">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_003_204">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="crypt.html">crypt()</a></i>,
<i><a href="setkey.html">setkey()</a></i>,
<i><a href="unistd.h.html">&lt;unistd.h&gt;</a></i>.
</blockquote><h4>DERIVATION</h4><blockquote>
Derived from Issue 1 of the SVID.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>

